package com.smh.demo1.a09;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;

/**
 * @author shiminghui
 * @date 2025/4/12 14:09
 * @description: TODO
 */
@Configuration
public class Config {

    @Bean
    public E e() {
        return new E();
    }

    @Bean
    @Scope("prototype")
    public B1 b1() {
        return new B1();
    }

    @Bean
    @Scope(value = "prototype", proxyMode = ScopedProxyMode.TARGET_CLASS) // 代理模式
    public B2 b2() {
        return new B2();
    }

//    @Bean
//    public ObjectFactory<B3> b3Factory() {
//        return B3::new;
//    }

    @Bean
    @Scope("prototype")
    public B3 b3() {
        return new B3();
    }

    @Bean
    @Scope("prototype")
    public B4 b4() {
        return new B4();
    }

}
